<?php
elgg_load_library('elgg:portfolio');

$usr_obj = elgg_get_logged_in_user_entity();
$usr_id = $usr_obj->username;

$today = last_working_day(strftime('%Y-%m-%d', time()));
$lastday = last_working_day($today);
//print_r($today);
//print_r($lastday);

$date_param = get_param_value('date_param', 'pnl_date_param', $lastday);
$date_param2 = get_param_value('date_param2', 'pnl_date_param2', $today);
$fund_param = get_param_value('fund_param', 'pnl_fund_param', 'SC001');

//print_r($fund_param);
//print_r(get_input($date_param));
//print_r(get_input($date_param2));

$tableArray = portfolio_get_pnl($date_param, $date_param2, $usr_id, $fund_param);
echo elgg_view('output/tablesorter', array(
	'value' => $tableArray,
	'tableid' => 'pnl'
));
